package cn.yzgy.yzgyoa.common.crsp;

import lombok.Getter;
import lombok.Setter;

/**
 * System status code
 * data format:
 * statusCode statusDescription
 * e.g.
 * 2000 执行成功
 * 4001 鉴权失败
 *
 * @author Yqsen
 * @version 0.0.1
 * @since 2019-8-15 11:51:48
 */
@SuppressWarnings("unused")
public enum StatusCode {

    // 返回状态码类型
    SUCCESS(2000, "操作成功"),
    NOT_FOUND(4004, "操作不存在"),
    EXCEPTION(5000, "服务器异常"),
    IO_EXCEPTION(5000, "IO异常，读写文件失败！"),
    FAILED(5001, "操作失败"),
    VALIDATION_FAILED(5002, "数据验证失败"),
    UN_AUTHORIZATION(4001, "用户未认证"),
    FORBIDDEN(4003, "您无权进行此操作"),

    // 账户异常代码
    USER_AUTHENTICATION_EXCEPTION(6000, "用户认证异常"),
    USER_NOT_EXIST(6001, "账户不存在"),
    USER_WRONG_PASSWORD(6002, "账户密码错误"),
    USER_FROZEN(6003, "账户被锁定"),

    // SQL异常
    SQL_DUPLICATE_KEY(6500, "数据违反了一个完整性约束（外键、主键或唯一键）"),
    SQL_DATA_NOT_FOUNT(6404, "您要查找的数据不存在"),

    // IOT平台异常代码
    IOT_EXCEPTION(7000, "IOT平台接口错误"),

    // 协议错误
    PROTOCOL_EXCEPTION(8000, "协议解析错误"),

    // 远程充值接口调用错误
    REMOTE_RECHARGE_CALL_EXCEPTION(9000, "充值接口错误"),
    REMOTE_RECHARGE_CALL_ORDER_NOT_EXIST(9001, "订单不存在"),
    REMOTE_RECHARGE_CALL_ORDER_NOT_PAY(9002, "订单尚未支付"),
    REMOTE_RECHARGE_CALL_HAD_SYNCED(9003, "订单同步状态异常"),
    REMOTE_RECHARGE_CALL_DB_ERROR(9004, "数据库读写异常"),
    ;

    @Getter
    @Setter
    private int code;

    @Getter
    @Setter
    private String msg;

    StatusCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }}
